package com.etoak.rst.sys.util;

public enum Result {

    SUCCESS("200","successs"),FAILED("500","failed");

    String code;
    String msg;
    private Result(String code,String msg){
        this.code = code;
        this.msg = msg;
    }

    public static JsonResponse success(String code,String msg,Object data){
        return new JsonResponse(code,msg,data);
    }
    public static JsonResponse success(String msg,Object data){
         return success(SUCCESS.code,msg,data);
    }
    public static JsonResponse success(Object data){
        return success(SUCCESS.msg,data);
    }
    public static JsonResponse success(){
        return success(null);
    }

    public static JsonResponse failed(String code,String msg,Object data){
        return new JsonResponse(code,msg,data);
    }
    public static JsonResponse failed(String code,String msg){
        return success(code,msg,null);
    }
    public static JsonResponse failed(String msg){
        return failed(FAILED.code,msg);
    }
}
